package top.duorhs.jspider.filter;

import lombok.SneakyThrows;

import java.lang.reflect.Field;
import java.util.HashSet;

/**
 * 过滤参数
 *
 * @author Duorhs
 * @date 2023/1/11 8:29
 */
public abstract class Filter {

    @SneakyThrows
    public HashSet<String> getFilters() {
        Field[] fields = this.getClass().getDeclaredFields();
        Field field = fields[0];
        field.setAccessible(true);
        Object o = field.get(this);
        if (o instanceof HashSet) {
            return (HashSet<String>) o;
        }
        return null;
    }
}
